package com.example.ytyproject.controller;


import com.alibaba.fastjson.JSONObject;
import com.example.ytyproject.entity.ShopMember;
import com.example.ytyproject.entity.ShopsBase;
import com.example.ytyproject.entity.vo.R;
import com.example.ytyproject.service.ShopMemberService;
import com.example.ytyproject.service.ShopsBaseService;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 商铺会员管理 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-05-13
 */
@RestController
@RequestMapping("/geek/shop/member")
@Slf4j
public class ShopMemberController {

    @Autowired
    private ShopMemberService shopMemberService;

    @PostMapping("/listByPage")
    public R listByPage(@RequestBody ShopMember param) {
        return shopMemberService.listByPage(param);
    }

    @PostMapping("/addData")
    public R addData(@RequestBody ShopMember param) {
        log.info("ShopMemberController addData param: {}", JSONObject.toJSONString(param));
        shopMemberService.addData(param);
        return R.ok();
    }

    @PostMapping("/updateData")
    public R updateData(@RequestBody ShopMember param) {
        log.info("ShopMemberController updateData param: {}", JSONObject.toJSONString(param));
        shopMemberService.updateData(param);
        return R.ok();
    }
    @DeleteMapping("/deleteData")
    public R deleteData(@Param("id") String id) {
        shopMemberService.removeById(id);
        return R.ok();
    }

}
